-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stats: Fix Stats view stuck on Insights tab if the grow audience card is showing #19417
Stats: Fix Stats view stuck on Insights tab if the grow audience card is showing #19417
Conversation
When we simply return, we can get into cases where selectedPeriod is not equal to .insights even though insights are open. In such an instance the tab switching doesn't work anymore.
Generated by 🚫 dangerJS |
Also cherry-picked bundler fix #19409 |
You can test the changes in Jetpack from this Pull Request by:
|
You can test the changes in WordPress from this Pull Request by:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding out how to reproduce this bug and for fixing it! 🙇
These are the steps I used to reproduce (taken from p5T066-3CX-p2#comment-13674) and my understanding of the issue:
- Open Stats
- Dismiss the "A tip to grow your audience" tip card that's shown
- Switch to the Months tab (the tab selection is persisted)
- Close Stats
- Open Stats and the Months tab is shown (correct)
- Switch to the Insights tab and a different tip is shown
- The new tab selection wasn't being persisted here, but with this PR it's correctly set to Insights
- Try to switch to the Month tab and notice the contents of the Insights tab are still show
- The "old" and "new" tab selections are both "Months", so the logic here doesn't set the view controller to show the screen that corresponds to Months
I agree that the approach you've taken which persists the tab selection as Insights if there is a tip card to be shown – or the specific Day/Week/Year tab if there is no tip card – is a good approach. The logic to take the user to the Insights tab if there is a tip card available (#17332) – no matter what tab they were previously on – is still working.
@guarani will the release branch be merged to the trunk once the release is done? Or should I make an additional PR to merge this change to trunk? |
Yep, you don't need to do that. |
@staskus this has been bundled as part of 20.9 beta 1 (20.9.0.1). Thanks for your work 🙌 |
Description
Fixes an issue, when the stats view is stuck on the Insights tab and switching tabs, doesn't work.
Root cause
The issue is caused by Stay on insights tab if Grow Audience card is showing change.
isGrowAudienceShowing
istrue
we don't save the selected tab to user defaults.updatePeriodView
incorrectly assumes that the wrong tab is selected and doesn't setperiodTableViewController
inpageViewController
.Solution
When
isGrowAudienceShowing
istrue
, explicitly set selected tab toinsights
.Testing instructions
Case 1:
Regression Notes
Stay on insights tab if Grow Audience card is showing
Manual testing scenarios
None
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Images & Videos
Before
before.MP4
After
after.MP4